package com.bwie.controller;

import com.bwie.pojo.Result;
import com.bwie.pojo.dto.ApplyDto;
import com.bwie.pojo.po.Apply;
import com.bwie.service.ApplyService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/apply")
public class ApplyController {
    @Autowired
    private ApplyService applyService;

    /**
     * 新增申请
     * @param apply
     * @return
     */
    @ResponseBody
    @PostMapping("addApply")
    public Result addApply(@RequestBody Apply apply){
        applyService.addApply(apply);
        return Result.success();
    }


    /**
     * 审核列表
     * @param applyDto
     * @return
     */
    @ResponseBody
    @GetMapping("getApplyList")
    public PageInfo<Apply> getApplyList(ApplyDto applyDto){
        PageInfo<Apply> pageInfo = applyService.getApplyList(applyDto);

        return pageInfo;
    }
}
